package j2025.j03;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author 猫大仙
 */
public class j0331 {
 List<Integer> ret = new ArrayList<>();
 public List<Integer> rightSideView(TreeNode root) {
  //index表示深度
  view(root,0);
  return ret;
 }
 private void view(TreeNode root, int index) {
  if(root == null) return;
  if(index == ret.size()) ret.add(root.val);
  view(root.right,index+1);
  view(root.left,index+1);
 }
}
